﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine.Graphics;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Engine.Physics.PObjects
{
    public class PhysicsModelEntity : ModelEntity, ICollisionable, IPhysicEntity
    {
        #region ICollisionable Members

        public CollisionType Type { get; set; }

        public BoundingBox BBox
        {
            get { return base.BoundingBox; }
        }

        public BoundingSphere Sphere
        {
            get { return base.BoundingSphere; }
        }

        private Plane plane;
        public Plane Plane
        {
            get { return plane; }
            set { plane = value; }
        }

        public event EventHandler<CollisionEventArgs> Collision;

        public void OnCollision(CollisionEventArgs args)
        {
            if (Collision != null)
                Collision(this, args);
        }

        public event EventHandler<CollisionEventArgs> Colliding;

        public void OnColliding(CollisionEventArgs args)
        {
            if (Colliding != null)
                Colliding(this, args);
        }


        #endregion

        #region IPhysicEntity Members

        public Vector3 Acceleration
        { get; set; }

        public Vector3 Velocity
        {
            get;
            set;
        }

        public float Mass
        {
            get;
            set;
        }

        public float Drag
        {
            get;
            set;
        }

        #endregion


        public PhysicsModelEntity(Entity parent, Model model)
            : base(parent, model)
        {
            Acceleration = Vector3.Zero;
            Velocity = Vector3.Zero;
            Mass = 1.0f;
            Drag = 1.0f;
        }





    }
}
